package xiaohu.day2.HJ23;

import java.util.Arrays;
import java.util.HashMap;
import java.util.Map;
import java.util.Scanner;

public class Main {
    public static void main(String[] args) {
        Scanner in = new Scanner(System.in);
        while (in.hasNextLine()) {
            String str = in.nextLine().toLowerCase();
            HashMap<Character, Integer> map = new HashMap<>();
            for (int i = 0; i < str.length(); i++) {
                char at = str.charAt(i);
                if (map.containsKey(at)) {
                    map.put(at, map.get(at) + 1);
                } else {
                    map.put(at, 1);
                }
            }
            int count=21;
            String[] key=new String[20];
            System.out.println(key.length);
            int index=0;
            for (Map.Entry<Character, Integer> characterIntegerEntry : map.entrySet()) {
                if (characterIntegerEntry.getValue() < count) {
                    Arrays.fill(key,null);
                    index=0;
                    count = characterIntegerEntry.getValue();
                    key[index] = characterIntegerEntry.getKey()+"";
                    index++;
                }
                if (characterIntegerEntry.getValue() == count) {
                    key[index] = characterIntegerEntry.getKey()+"";
                    index++;
                }
            }
            for (int i = 0; i < key.length; i++) {
                if (key[i] != null) {
                    str=str.replaceAll(key[i], "");
                }
            }
            System.out.println(str);
        }
    }
}
